package com.go.where.manager.action.go;

import javax.annotation.Resource;

import org.apache.log4j.Logger;

import com.go.where.manager.action.SuperAction;
import com.go.where.manager.common.Constants;
import com.go.where.manager.page.Pagination;
import com.go.where.manager.pojo.CustomerCommentInfo;
import com.go.where.manager.service.CustomerCommentService;
import com.go.where.manager.util.CommonUtil;
import com.google.gson.Gson;

public class CustomerCommentAction extends SuperAction {

	private static final long serialVersionUID = 1L;
	private static final Logger log = Logger
			.getLogger(CustomerCommentAction.class);
	@Resource(name = "customerCommentService")
	private CustomerCommentService customerAddressService;
	private CustomerCommentInfo customerCommentInfo;
	private CustomerCommentInfo customerCommentInfoQuery;
	private String id;
	public Pagination<?> page;

	Gson gson = CommonUtil.gson();

	/**
	 * 查询列表
	 * 
	 * @return
	 */
	public String list() {
		if (customerCommentInfoQuery == null) {
			customerCommentInfoQuery = new CustomerCommentInfo();
			customerCommentInfoQuery.setPageSize(Constants.INIT_PAGESIZE);
			customerCommentInfoQuery.setCurrentPage(Constants.INIT_CURRENTPAGE);
		}
		try {
			customerCommentInfoQuery.setIsDelete(Constants.NOT_DELETED);
			page = customerAddressService.queryPage(customerCommentInfoQuery);
		} catch (Exception e) {
			addActionError(e.getMessage());
			log.error("查询信息异常", e);
		}

		return LIST;
	}

	/**
	 * 假删除
	 * 
	 * @return
	 */
	public String falseDelete() {
		customerCommentInfo = new CustomerCommentInfo();
		customerCommentInfo.setId(id);
		customerCommentInfo.setIsDelete(Constants.DELETED);
		try {
			this.redirectionUrl = "customer_comment!list.htm";
			customerAddressService.update(customerCommentInfo);
		} catch (Exception e) {
			addActionError("删除信息异常" + e.getMessage());
			log.error("删除信息异常", e);
		}
		return SUCCESS;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public CustomerCommentInfo getCustomerCommentInfo() {
		return customerCommentInfo;
	}

	public void setCustomerCommentInfo(CustomerCommentInfo customerCommentInfo) {
		this.customerCommentInfo = customerCommentInfo;
	}

	public CustomerCommentInfo getCustomerCommentInfoQuery() {
		return customerCommentInfoQuery;
	}

	public void setCustomerCommentInfoQuery(
			CustomerCommentInfo customerCommentInfoQuery) {
		this.customerCommentInfoQuery = customerCommentInfoQuery;
	}

	public Pagination<?> getPage() {
		return page;
	}

	public void setPage(Pagination<?> page) {
		this.page = page;
	}

}
